package com.example.service.impl;

import com.example.entity.Table;
import com.example.dao.TableDao;
import com.example.service.TableService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * (Table)表服务实现类
 *
 * @author makejava
 * @since 2024-06-11 19:14:58
 */
@Service
public class TableServiceImpl implements TableService {
    @Resource
    private TableDao tableDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Table queryById(Integer id) {
        return this.tableDao.queryById(id);
    }

    @Override
    public List<Table> queryFreeAll() {
        return this.tableDao.queryFreeAll();
    }

    @Override
    public Table update(Table table) {
        int i = this.tableDao.updateByPrimaryKeySelective(table);
        return queryById(table.getId());
    }
}
